<?php

class Application_Model_Logement
{
	protected $_nomCourt;
	protected $_numero;
	protected $_superficie;
	protected $_typeLogement;
	protected $_etage;
	protected $_noteLogement;
	protected $_id;
	
	public function __construct(array $options = null)
	{
		if (is_array($options)) {
			$this->setOptions($options);
		}
	}
	
	public function __set($name, $value)
	{
		$method = 'set' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid logement property');
		}
		$this->$method($value);
	}
	
	public function __get($name)
	{
		$method = 'get' . $name;
		if (('mapper' == $name) || !method_exists($this, $method)) {
			throw new Exception('Invalid logement property');
		}
		return $this->$method();
	}
	
	public function setOptions(array $options)
	{
		$methods = get_class_methods($this);
		foreach ($options as $key => $value) {
			$method = 'set' . ucfirst($key);
			if (in_array($method, $methods)) {
				$this->$method($value);
			}
		}
		return $this;
	}
	
	public function setNomCourt($text)
	{
		$this->_nomCourt = $text;
		return $this;
	}
	
	public function getNomCourt()
	{
		return $this->_nomCourt;
	}
	
	public function setNumero($num)
	{
		$this->_numero = $num;
		return $this;
	}
	
	public function getNumero()
	{
		return $this->_numero;
	}
	
	public function setSuperficie($sup)
	{
		$this->_superficie = $sup;
		return $this;
	}
	
	public function getSuperficie()
	{
		return $this->_superficie;
	}
	
	public function setTypeLogement($sup)
	{
		$this->_typeLogement = $sup;
		return $this;
	}
	
	public function getTypeLogement()
	{
		return $this->_typeLogement;
	}
	
	public function setEtage($sup)
	{
		$this->_etage = $sup;
		return $this;
	}
	
	public function getEtage()
	{
		return $this->_etage;
	}
	
	public function setNoteLogement($sup)
	{
		$this->_noteLogement = $sup;
		return $this;
	}
	
	public function getNoteLogement()
	{
		return $this->_noteLogement;
	}
	
	public function setId($id)
	{
		$this->_id = (int) $id;
		return $this;
	}
	
	public function getId()
	{
		return $this->_id;
	}

}

